define(function() {
    return ['$scope','$location', '$routeParams','$timeout','bizProxy', function($scope,$location,$routeParams,$timeout,bizProxy) {
        $scope.$emit("top-show",'true');//顶部显示
        $scope.$emit('menuTypeLight','loan'); 	//控制底部menu高亮
        $scope.$emit('bub-menu','true'); 	//隐藏底部menu
        $scope.$emit('flag-tag','74'); 	//显示底部文字

        $scope.title_anJian=true;
        $scope.title_shenPi=false;
        $scope.con_anJian=true;
        $scope.con_shenPi=false;
        $scope.setSlt=function (slt) {
            $timeout(function () {
                $scope.title_shenPi=false;
                $scope.title_anJian=false;
                $scope.con_anJian=false;
                $scope.con_shenPi=false;
                $scope['title_'+slt]=true;
                $scope['con_'+slt]=true;
            })
        };
        queryCaseInfoDetail();
        function queryCaseInfoDetail() {
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.caseId = $routeParams.caseId;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryCaseInfoDetail",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    console.log(JSON.parse(tempData.body));
                    var res=JSON.parse(tempData.body);
                    if(tempData.isSuccess==='T'){
                        //案件状态：1未提交；2已提交；3业务审核通过；4风控审核通过；5已承接；0已关闭；A审核拒绝B待委托；C已委托
                        //风险投状态：1合同未确认；2合同已确认；3合同已签约；4财务已审核；5财务已放款；6部分已回款；0已关闭；A审核拒绝
                        $timeout(function(){
                            $scope.caseInfo=res;
                        });
                        queryCaseOrderDetail()
                    }
                },function(data){
                    console.log(data);
                    $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        function queryCaseOrderDetail() {
            var headerInfo = {},bizInfo = {};
            headerInfo.pageNum = '';
            headerInfo.pageSize = '';
            headerInfo.sessionId = transData.sessionId;

            bizInfo.orderId = $routeParams.orderId;
            $scope.$emit("loadingChange",true);
            bizProxy.queryProxyBizData("queryCaseOrderDetail",headerInfo,bizInfo,
                function(tempData){//SUCCESS
                    $scope.$emit("loadingChange",false);
                    console.log(JSON.parse(tempData.body));
                    var res=JSON.parse(tempData.body);
                    if(tempData.isSuccess==='T'){
                        //案件状态：1未提交；2已提交；3业务审核通过；4风控审核通过；5已承接；0已关闭；A审核拒绝B待委托；C已委托
                        //风险投状态：1合同未确认；2合同已确认；3合同已签约；4财务已审核；5财务已放款；6部分已回款；0已关闭；A审核拒绝
                        $timeout(function(){
                            $scope.memoContent=JSON.parse(res.memoContent);
                            $scope.status=res.status;
                        });
                    }
                },function(data){
                    console.log(data);
                    $scope.$emit("loadingChange",false);
                    if(data.errorMsg){
                        $scope.$emit("promptAlertMsg",data.errorMsg);
                        $scope.$emit("showCollect",true);
                        $timeout(function(){
                            $scope.$emit("showCollect",false);
                        },transData.promptTime);
                    }
                });
        }
        $scope.$apply();
    }];
});